import javax.swing.*;
import java.sql.SQLOutput;
import java.util.Random;
import java.util.Scanner;
public class aaa12 {
    public static void main(String[] args) {
        System.out.println("------欢迎来到我的世界-------");
        //键盘录入你选择的小人物的序号：
        System.out.println("输入你将要打败的小人物的序号：1.朱八卦 2.宇航员 3.保罗乔治");
        Scanner sc = new Scanner(System.in);
        int enemy = sc.nextInt();//nextInt(）-录入int类型数据
        System.out.println("输入你的人物名字");
        String myself = sc.next();//next()-录入字符串
        //将小人物的序号转换为名字；
        String enemyName = "";
        //分支结构的转换
        switch (enemy) {
            case 1:
                enemyName = "朱八卦";
                break;
            case 2:
                enemyName = "宇航员";
                break;
            case 3:
                enemyName = "保罗乔治";
                break;
        }
        //即将开始pk
        System.out.println("小人物【" + enemyName + "】和【”+myself+“】即将开打！");
        //提示是否开始游戏
        System.out.println("确认是否开始游戏?Y/N");
        String isStart = sc.next();
        //判断Y/N
        if (isStart.equalsIgnoreCase("Y")) {//游戏开始-录入Y/大学区别？
            //定义分数
            int myScore = 0;
            int enemyScore = 0;
            //五局游戏:
            for (int i = 1; i < 5; i++) {//i:第几局游戏
                System.out.println("第i局游戏开始：");
                //你出拳
                System.out.println("请你出拳：1.石头 2.剪刀 3.布");
                int choice = sc.nextInt();

                int enemyChoice=new Random().nextInt(3)+1;
                System.out.println("我的出拳结果是:" + change(choice));
                System.out.println("敌人的出拳结果是" + change(enemyChoice));
            //谁赢谁输：
            if ((choice == 1 && enemyChoice == 2) || (choice == 2 && enemyChoice == 3) || (choice == 3 && enemyChoice == 1)) {//你赢了
                System.out.println("我赢了！");
                myScore++;
            } else if ((choice == 1 && enemyChoice == 1) || (choice == 2 && enemyChoice == 2) || (choice == 3 && enemyChoice == 3)) {//平局了
                System.out.println("平局了！");
            } else {//你输了
                System.out.println("你输了！");
                enemyScore++;
            }
        }
        //加入结果：
        if (myScore > enemyScore) {
            System.out.println("我赢了");
        } else if (myScore == enemyScore) {
            System.out.println("平局");
        } else {
            System.out.println("系统赢了");
        }
    }else{//游戏结束
            System.out.println("游戏结束");
        }
    }
       //将数字变成文字
        public static String change(int choice) {
        String ch = "";
        switch (choice) {
            case 1:
                ch = "石头";
                break;
            case 2:
                ch = "剪刀";
                break;
            case 3:
                ch = "布";
                break;
        }
        return ch;
    }
}